package com.example.demo.design.chainhandle;

import org.springframework.stereotype.Component;

import javax.annotation.Resource;

//@Component
//public class AdminDpHandler extends BaseResponsibilityChainHandler<SpProjectDpDTO> {
//    @Resource
//    private SpCommonUtil spCommonUtil;
//
//    @Override
//    public void doHandler(SpProjectDpDTO spProjectDpDTO) {
//        boolean isAdminOrSpOperator = spCommonUtil.isAdminOrSpOperator(spProjectDpDTO.getDomain(), spProjectDpDTO.getOaSerial());
//        if (isAdminOrSpOperator) {
//            spProjectDpDTO.setIsAllData(Boolean.TRUE);
//            spProjectDpDTO.setIdList(null);
//            return;
//        }
//        spProjectDpDTO.setIsAllData(Boolean.FALSE);
//        this.executeNextHandler(spProjectDpDTO);
//    }


//    private BaseResponsibilityChainHandler<SpProjectDpDTO> gainProjectDpChain() {
//        if (Objects.nonNull(this.projectDpChain)) {
//        return this.projectDpChain;
//        }
//        //handler的顺序是有序的，权限可以中断处理
//        this.projectDpChain = new BaseResponsibilityChainHandler.Builder<SpProjectDpDTO>()
//        .addHandler(adminDpHandler)//具备最高数据权限，则中断处理，否则继续执行
//        .addHandler(spProjectPersonDpHandler)
//        .addHandler(spActivityPersonDpHandler)
//        .addHandler(spRegionPersonDpHandler)
//        .build();
//        return this.projectDpChain;
//    }

//}
